<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends MX_Controller {
    
  function __construct() {      
    
    $this->load->library('template');
    $this->load->library('form_eksternal');
    $this->load->library('global_models');
    $this->load->library('PHPExcel');
    $this->load->library('encrypt');
    $this->load->helper('path');
    $this->load->helper('url');
    $this->load->helper('form');
    $this->load->library('parser');
    $this->load->library('session');
    $this->load->library('form_validation');
    $this->load->library('pagination');
    $this->load->library('email');
    $this->load->model('home/mhome');
    $this->menu = $this->cek();
    
//    $this->debug($this->menu, true);
  }
  public function kirim_mail(){
    if($this->input->post(NULL)){
      $this->email->mailtype = "html";
      $this->email->from('budhi_nusa@yahoo.com', 'Nugroho');
//      $this->email->to("7inus.5aint@gmail.com");
      $this->email->to($this->input->post('email'));
      $this->email->cc("budhi_nusa@yahoo.com");

      $this->email->subject('Web Aplikasi');
      $this->email->message($this->mhome->get_pesan());

      if($this->email->send() === TRUE){
        redirect ("users");
      }
      else
        redirect ("home");
    }
    else{
      $this->template->build("mail", 
        array(
              'url'         => base_url()."themes/srabon/",
              'title_table' => "Email",
            ));
      $this->template
        ->set_layout('default')
        ->build("mail");
    }
  }
	public function index(){
    
//    $start = strtotime("2014-01-25");
//    $end = strtotime("2014-02-5");
//    
//    $ct = strtotime("2014-02-5");
//    $ct2 = strtotime("2014-02-6");
//    $this->debug(($ct2 - $ct));
//    $ct = strtotime("2014-02-28");
//    $ct2 = strtotime("2014-03-01");
//    $this->debug(($ct2 - $ct));
//    $ct = strtotime("2014-02-22");
//    $ct2 = strtotime("2014-02-23");
//    $this->debug(($ct2 - $ct));
//    
//    $ft = $ct2 - $ct;
//    
//    for($r = $start ; $r <= $end ; $r += $ft){
//      $this->debug(date("Y-m-d", $r));
//    }
//    die;
    $this->template->build("main", 
      array('message'     => $pesan,
            'url'         => base_url()."themes/srabon/",
            'menu_drop'   => $this->menu,
            'menu'        => "",
            'title_table' => "Home",
            'foot'        => ""
          ));
    $this->template
      ->set_layout('default')
      ->build("main");
	} 
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */